<#import "./layout.ftl" as l>
<#assign header>
</#assign>
<#assign footer>
    <script src="/assets/students.js"></script>
</#assign>
<@l.layout title='学生信息列表' header=header footer=footer>

    <div class="filters">
        <form autocomplete="off" method="get" action="/students" class="form-inline"
              id="searchForm">
            <ul class="filter">
                <li>
                    <label>  分类：</label>
                    <div class="input">
                        <select name="typeId" id="typeId" class="form-control" data-id="${(search.typeId)!}"></select>
                    </div>
                </li>
                <li>
                    <label>姓名：</label>
                    <div class="input">
                        <input type="text" class="form-control" name="name"
                               value="${(search.name)!}">
                    </div>
                </li>
                <li>
                    <button type="submit" class="btn btn-success" id="searchBtn">
                        <i class="fa fa-search"></i> 查询信息
                    </button>
                </li>
            </ul>
        </form>
    </div>
    <div class="btn-toolbar">
        <a class="btn  btn-primary" href="/students/add">
            新建学生信息
        </a>
    </div>
    <div class="list">
        <table class="table table-hover  table-striped">
            <thead>
            <tr>
                <th class="col-md-3">姓名</th>
                <th class="col-md-2">分类</th>
                <th class="col-md-2">性别</th>
                <th class="col-md-3">出生日期</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <#list list as item>
                <tr>
                    <td>${(item.name)!}</td>
                    <td>${(item.type.name)!}</td>
                    <td>${(item.sex)!}</td>
                    <td>${(item.birthday)!}</td>
                    <td>
                        <a href="/students/${(item.id)!}/edit">编辑</a> &nbsp;&nbsp;
                        <a href="#" class="list-delete" data-id="${(item.id)!}">删除</a>
                    </td>
                </tr>
            </#list>
            </tbody>
        </table>
    </div>
</@l.layout>
